/**
 * [DragonApp.model.Notice description]
 * 公告数据模型
 */
Ext.define('DragonApp.model.Notice', {
    extend: 'Ext.data.Model',
    requires: ['DragonApp.ux.config.Config'],

    fields: [
    {name: 'id'},{name: 'begintime'},{name: 'endtime'},{name: 'channel'},{name: 'title'},{name: 'content'},{name: 'tag'},{name: 'type'},{name: 'create_time'},
    {name: 'preview',  convert: function (value, record) {
        var content = record.get('content');
        var parser = new CODE();
        if( true != Ext.isEmpty(content)){
          return parser.CodePrase(content);
        }else{
          return '';
        }
      }
    },
    {name: 'pictures'},
    {name: 'pics',  convert: function (value, record) {
        if( true != Ext.isEmpty(record.get('pictures')) && ( '图像' == record.get('type') )){
            var pics = record.get('pictures').split(",");
            pics.forEach(function(currentValue, index, arr){
              pics[index] = DragonApp.ux.config.Config.getNoticeUrl(currentValue);
            });

            return pics;
        }else{
            return [];
        }
     }
    }
    ]
});